package com.study.ssm.aop.spring;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;

/**
 * @author zhoujunlin
 * @date 2023年07月24日 14:40
 * @desc
 */
@Aspect
public class MyAspect {

    /*
     * 切入点复用
     * */
    @Pointcut(value = "execution(* register(..))")
    public void myPointcut() {
    }

    @Around("myPointcut()")
    public Object processed(ProceedingJoinPoint pjp) {
        Object ret = null;
        try {
            System.out.println("MyAspect.processed before");
            ret = pjp.proceed();
            System.out.println("MyAspect.processed after");
        } catch (Throwable e) {
            System.out.println("MyAspect.processed exception");
            e.printStackTrace();
        }
        return ret;
    }


}
